<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('Select Services')" />
</head>
<body class="gray-bg">
<input type="hidden" id="rowIds">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "system/request";
    var datas = [[${@dict.getType('sys_normal_disable')}]];
    var statusDatas = [[${@dict.getType('sys_normal_disable')}]];

    $(function() {
        var options = {
            url: prefix + "/sevList",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            columns: [{
                checkbox: true
            },
                {
                    field: 'serviceId',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'serviceName',
                    title: '服务名称'
                },
                {
                    field: 'serviceType.svtypeName',
                    title: '服务类型'
                },
                {
                    field: 'instrument.instName',
                    title: '仪器'
                },
                {
                    field: 'zkTemplate.templateName',
                    title: '模板'
                },
                {
                    field: 'solvents',
                    title: '溶剂'
                }]
        };
        $.table.init(options);
    });


    function submitHandler(index, layero) {
        var rows = $.table.selectFirstColumns();
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一个服务");
            return;
        }
        $.modal.close();
        // 父页面的方法
        // activeWindow().selectUsers();
        // 父页面的变量
        // activeWindow().$('#input-select').html(rows.join());
    }

    function getSelections() {
        return $.table.selectColumns("serviceName",false);
    }

    function getIdSelections() {
        return $.table.selectFirstColumns();
    }

    $("#bootstrap-table").on("check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table", function (e, rowsAfter, rowsBefore) {
        var rows = $.common.equals("uncheck-all", e.type) ? rowsBefore : rowsAfter;
        var rowIds = $.table.affectedRowIds(rows);
        $("#rowIds").val(rowIds);
    });
</script>
</body>
</html>